﻿using System;

namespace KiraSh.ResumeTracker
{
    public class Company : IComparable<Company>
    {
        /// <summary>
        ///  name of the company
        /// </summary>
        public string Name
        {
            set;
            get;
        }

        /// <summary>
        /// path to the xml with all the applications
        /// </summary>
 
        public string Path
        {
            set;
            get;
        }

        public override string ToString()
        {
            return Name;
        }


        /// <summary>
        /// implementation of the compare to 
        /// allow sorting alphabetically by name
        /// </summary>
        /// <param name="c"> Company </param>
        /// <returns></returns>
        public int CompareTo(Company c)
        {
            return Name.CompareTo(c.Name);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            if (obj is Company) 
            {
                Company other = (Company)obj;
                return other.Name == this.Name;
            }

            return base.Equals(obj);
        }
    }
}
